package com.delong.service;

import java.io.IOException;
import org.apache.ibatis.session.SqlSession;

import com.delong.dao.DaoHelper;
import com.delong.dao.UserMapper;
import com.delong.model.user.User;

public class UserService {

	public User selectUser(String username, String password) {
		SqlSession session = null;
		User user = null;
		try {
			session = DaoHelper.getSqlSessionFactory().openSession();
			UserMapper mapper = session.getMapper(UserMapper.class);
			user = mapper.selectUser(username, password);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (session != null) {
				session.close();
			}
		}

		return user;
	}
}
